<div id="list_data"></div>
<script>
    $(function () {
        var menu_id = "{{$menu_id}}";

        $('#list_data').datalist({
            checkbox: true,
            lines: true,
            url: '/sys/menu/getMenuBtnlist?menu_id='+menu_id,
            queryParams: {
                _token: $('meta[name="csrf-token"]').attr('content'),
                curr_menu_id: $('meta[name="curr_menu_id"]').attr('content')
            },
            selectOnCheck: false,
            columns: [[
                {title: 'id', field: 'id', hidden: true,width: 60 },
                {title: '名称', field: 'name', width: 130},
                {title: 'code', field: 'code', width: 130},
                {title: '图标样式', field: 'icon_style', width: 130,formatter:function(value,row,index){
                    return '<i class="'+value+'" style="width: 16px;height: 16px;display: inline-block;"></i>'
                }},
                {title: '方法名', field: 'func', width: 130},
                {title: '是否生效', field: 'is_active', width: 130,formatter:function(value,row,index){
                    if(value=='1'){
                        return '生效'
                    }else{
                        return '无效'
                    }
                }},
            ]],
            onCheck: function(index, row){

            },
            rowStyler: function(index,row){

            },
            onLoadSuccess: function (data) {
                if(data){
                    $.each(data.rows, function(index, item){
                        if(item.checked){
                            $('#list_data').datalist('checkRow', index);
                        }
                    });
                }
            }
        });

    });
</script>

